<?php defined('IN_IA') or exit('Access Denied');?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title><?php  echo $active['title'];?></title>
<link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/index.min.css?v=2019051002">
<script>
    var require = {
        urlArgs: 'v=2019050905',
        baseUrl: '.',
        paths: {
            'jquery': '<?php echo WEB_RESOURCE;?>/lib/jquery/jquery.min',
            'swiper': '<?php echo WEB_RESOURCE;?>/lib/swiper/swiper.min',
            'weui': '<?php echo WEB_RESOURCE;?>/lib/weui/weui.min',
            'tools': '<?php echo WEB_RESOURCE;?>/mobile/js/tool',
            'util': 'resource/js/app/util',
            'barrager': '<?php echo WEB_RESOURCE;?>/lib/jquery/barrager/jquery.barrager.min'
        },
        map: {
            '*': {
                'css': '<?php echo WEB_RESOURCE;?>/lib/css.min.js',
            }
        },
        shim: {
            'swiper': ['jquery', 'css!<?php echo WEB_RESOURCE;?>/lib/swiper/swiper.min'],
            'weui': ['jquery','css!<?php echo WEB_RESOURCE;?>/lib/weui/weui.min'],
            'tools': {deps: ['jquery']},
            'barrager': {deps: ['jquery', 'css!<?php echo WEB_RESOURCE;?>/lib/jquery/barrager/barrager.min']}
        }
    };
</script>
<script src="<?php echo WEB_RESOURCE;?>/lib/require.min.js?v=2019042601"></script>
<script type="text/javascript" src="./resource/js/lib/mui.min.js?v=20181228"></script>

</head>
<body>
<div id="app">
    <!-- 遮盖层 -->
    <div class="dialog"></div>
    <!-- 顶部图片 -->
    <div class="head-nav"><img src="<?php  echo tomedia($active['cover']);?>"></div>
    
    <!-- 活动 -->
    <?php  if(!empty($tickets)) { ?>
    <div class="active">
        <!-- 活动培训班 -->
        <?php  if(is_array($tickets)) { foreach($tickets as $index => $ticket) { ?>
        <table class="active-tickets">
            <tr class="active-business">
                <td class="header-left" style="width:72px">
                    <img src="<?php  echo tomedia($ticket['avatar']);?>" class="active-class-avatar" data-url="<?php  echo $ticket['mch_link'];?>">
                    <?php  if(empty($ticket['getted'])) { ?>
                        <a href="javascript:;" class="active-class-button active-class-button-color<?php  echo $index%4+1?> card-receive" data-ticket-id="<?php  echo $ticket['ticket_id'];?>">点击领取</a>
                    <?php  } else { ?>
                        <span class="active-class-button-geted">已领取</span>
                    <?php  } ?>
                </td>
                <td class="price" style="width:66px">
                    <p style="font-size:16px">价值<br/><?php  echo $ticket['amount'];?>元</p>
                </td>
                <td class="active-content">
                    <?php  echo $ticket['ticket_desc'];?>
                </td>
            </tr>
        </table>
        <?php  } } ?>
    </div>
    <?php  } ?>
    <div class="main-content" style="margin-top: -1px;">
        <!-- 购买记录循环 -->
        <div class="bussiness">
            <?php  if($active['outtime'] > 0) { ?>
            <!-- 活动商家标题 -->
            <div class="buiness-title">
                <div class="line-left"></div>
                <div class="active-rule">活动时间</div>
                <div class="line-right"></div>
            </div>
            <!-- 距离时间 -->
            
            <div class="timer" id="timer" data-outtime="<?php  echo $active['outtime'];?>">
                <span id="_d1">9</span><span id="_d2">9</span><span id="_d3">9</span><strong>天</strong><span id="_h1">2</span><span id="_h2">3</span><strong>时</strong><span id="_m1">5</span><span id="_m2">9</span><strong>分</strong><span id="_s1">5</span><span id="_s2">9</span><strong>秒</strong>
            </div>
            <?php  } else { ?>
            <div class="timer">活动已结束</div>
            <?php  } ?>
            <!-- 购买记录 -->
            <div class="shop-history">
                <div class="history-title">
                    <p>购买记录</p>
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/origin.png">
                </div>
                <!--购买记录 循环列表 -->
                <div class="swiper-container swiper-no-swiping" style="overflow:hidden">
                  <?php  if(!empty($buys)) { ?>
                    <div class="swiper-wrapper">
                        <?php  if(is_array($buys)) { foreach($buys as $buy) { ?>
                        <div class="swiper-slide">
                            <div class="user-history clearfloat">
                                <div class="user-header float-left">
                                    <img src="<?php  echo $buy['avatar'];?>" style="width:58px;height:58px">
                                </div>
                                <div class="userMessage float-left">
                                    <p style="margin-top:5px"><?php  echo $buy['nickname'];?></p>
                                    <p style="color:red;"><?php  echo trim_mobile($buy['mobile'])?></p>
                                </div>
                                <div class="time float-right">
                                    <p><?php  echo date('Y-m-d', $buy['complete_time'])?></p>
                                </div>
                            </div>
                        </div>
                        <?php  } } ?>
                    </div>
                  <?php  } else { ?>
                  <p class="text-center" style="line-height:90px">暂无记录</p>
                  <?php  } ?>
                </div>
            </div>
        </div>
        <!-- 活动商家 -->
        <div class="active-title">
            <div class="title-bus">
                活动商家
            </div>
        </div>
        <!-- 跆拳道类 -->
        <div class="mch-content">
        <?php  if(is_array($mchs)) { foreach($mchs as $mch) { ?>
        <div class="taekwondo">
            <p class="mch-content-title"><?php  echo $mch['mch_name'];?></p>
            <?php  echo $mch['content'];?>
            <div class="rule-title">
                <div class="line-left"></div>
                <div class="active-rule">优惠活动</div>
                <div class="line-right"></div>
            </div>
            <?php  echo $tickets[$mch['ticket_id']]['des'];?>
        </div>
        <?php  } } ?>
        </div>
        <!-- 活动规则标题 -->
        <div class="rule-title" style="padding-left:30px;padding-right:30px;">
            <div class="line-left"></div>
            <div class="active-rule">活动规则</div>
            <div class="line-right"></div>
        </div>
        <!-- 规则内容 -->
        <div class="rule-content" style="padding-left:30px;padding-right:30px;">
            <?php  echo $active['rules'];?>
        </div>
        <!-- 购买记录 -->
        <div class="history">
            <div class="history-shop">
                购买记录
                <span class="history-shop-total">总计：<?php  echo $active['orders'];?>人</span>
            </div>
            <!-- 购买记录表 -->
            <table>
            <tr>
                <th class="text-left" style="width:33.3333%">姓名</th>
                <th class="text-center" style="width:33.3333%">手机号</th>
                <th class="text-right" style="width:33.3333%">购买状态</th>
            </tr>
            </table>
            <p class="text-center load-more">点击加载更多</p>
        </div>
        <!-- 技术支持 -->
        <?php  echo $active['support_name'];?>
        <!-- 分享 扫码关注按钮 -->
        <div style="height: 40px"></div>
        <div class="btn">
            <?php  if($active['outtime'] > 0) { ?>
                <a href="<?php  echo web2app_url('main', ['et'=>'showPosters', 'src'=>$posters, 'title'=>$active['title'], 'type'=>'red'])?>" style="color:#ff9934;width:100%">分享赚钱</a>
                <?php  if(!empty($order) && $order['status'] == 'pay_done' && !empty($active['pay_done_btn_name'])) { ?>
                    <a href="javascript:;" class="share pay-btn" style="width:100%"><?php  echo $active['pay_done_btn_name'];?></a>
                <?php  } ?>
                <?php  if(empty($order) || $order['status'] == 'wait_pay') { ?>
                    <a href="javascript:;" class="pay-btn form-control" style="width:100%"><?php  echo $active['price'];?>元立即抢购</a>
                <?php  } ?>
            <?php  } else { ?>
                <span style="text-align: center;display: inline-block;width: 100%;color:#ccc;font-size:18px" disabled>活动已结束</span>
            <?php  } ?>
        </div>
    </div>
    <!-- 提交模态框 -->
    <div class="pay-btn2" style="display: none">
        <form class="register" method="POST" id="form" action="<?php  echo web2app_url('main', ['et'=>'createOrder'])?>">
            <input type="hidden" name="active_id" value="<?php  echo $active['id'];?>">
            <input type="hidden" name="order_sn" value="<?php  echo $order['order_sn'];?>">
            <input type="hidden" name="oid" value="<?php  echo $_GPC['oid'];?>">
            <input type="hidden" name="oi" value="<?php  echo $_GPC['oi'];?>">
            <div class="close-btn">x</div>
            <div class="userMsg">
                <div><input type="text" name="name" placeholder="请输入姓名" value="<?php  echo $order['name'];?>"></div>
                <div><input type="text" name="mobile" placeholder="请输入电话号码" value="<?php  echo $order['mobile'];?>"></div>
            </div>
            <div class="register">
                <label class="agreement">
                    <input type="checkbox" class="agreement-input" id="agreement" checked>
                    <span class="agreement-input"></span>&emsp;我已认真阅读并同意活动规则
                </label>
            </div>
            <div class="purchase">
                <button type="submit" id="purchase">开始抢购</button>
            </div>
        </form>
    </div>
    <?php  if(!empty($active['pay_done_cover'])) { ?>
    <!-- 二维码模态框 -->
    <div class="wxpicture" style="display: none">
        <div>
            <div class="close-wxpic">x</div>
            <img src="<?php  echo tomedia($active['pay_done_cover']);?>" <?php  if(!empty($active['pay_done_link'])) { ?>
            onclick=" location.href='<?php  echo $active['pay_done_link'];?>' " <?php  } ?>>
        </div>
    </div>
    <?php  } ?>
    <!-- 固定导航栏 -->
    <div class="fixed-nav">
        <?php  if(empty($order) && !empty($active['music'])) { ?>
        <div class="nav-btn" id="music_control" data-open-src="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/2.png?v=2019051001" data-close-src="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/1.png?v=2019051001" style="background-image: url(<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/2.png?v=2019051001)">
            <span class="nav-btn-text" style="color:#008000">关闭<br>声音</span>
            <audio src="<?php  echo tomedia($active['music']);?>" id="music" autoplay loop></audio>
        </div>
        <?php  } else if(!empty($active['music_order'])) { ?>
        <div class="nav-btn" id="music_control" data-open-src="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/2.png?v=2019051001" data-close-src="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/1.png?v=2019051001" style="background-image: url(<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/2.png?v=2019051001)">
            <span class="nav-btn-text" style="color:#008000">关闭<br>声音</span>
            <audio src="<?php  echo tomedia($active['music_order']);?>" id="music" autoplay loop></audio>
        </div>
        <?php  } ?>
        <div class="nav-btn" style="background-image: url(<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/3.png?v=2019051001)">
            <a href="tel:<?php  echo $active['tel'];?>" class="nav-btn-link">
                <span class="nav-btn-text" style="color:rgb(6,122,255);">联系<br>客服</span>
            </a>
        </div>
        <?php  if(!empty($myMchId)) { ?>
        <div class="nav-btn" style="background-image: url(<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/4.png?v=2019051001)">
            <a href="<?php  echo web2app_url('mchCenter', ['et'=>'mchCenter', 'pid'=>$active['id']])?>">
                <span class="nav-btn-text" style="color:rgb(104,52,152);">商家<br>中心</span>
            </a>
        </div>
        <?php  } else { ?>
        <div class="nav-btn" style="background-image: url(<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/5.png?v=2019051001)">
            <a href="<?php  echo web2app_url('main', ['et'=>'join','pid'=>$active['id']])?>">
                <span class="nav-btn-text" style="color:rgb(255,45,201);">申请<br>加盟</span>
            </a>
        </div>
        <?php  } ?>
        <div class="nav-btn" style="background-image: url(<?php echo WEB_RESOURCE;?>/mobile/theme/page1/images/6.png?v=2019051001)">
            <a href="<?php  echo web2app_url('personalCenter', ['et'=>'index', 'pid'=>$active['id']])?>">
                <span class="nav-btn-text" style="color:rgb(252,134,0);">个人<br>中心</span>
            </a>
        </div>
    </div>
</div>
<script type="text/javascript">
    window.self = {
        active_id: "<?php  echo $active['id'];?>",
        active_title: "<?php  echo $active['title'];?>",
        get_ticket_api: "<?php  echo web2app_url('main', ['et'=>'getTicket'])?>",
        get_bullet_api: "<?php  echo web2app_url('main', ['et'=>'getBullet'])?>",
        mname: "<?php  echo MNAME?>",
        order_sn: "<?php  echo $order['order_sn'];?>",
        timestamp: "<?php  echo TIMESTAMP?>",
        watch_order: "<?php echo !empty($active['pay_done_cover']) && $order['status'] == 'pay_done' ? 1 : 0?>",
        show_barrager: "<?php  echo $active['show_barrager'];?>",
        buys_list_api: "<?php  echo web2app_url('main', ['et'=>'getBuysList'])?>"
    };
</script>
<script src="<?php echo WEB_RESOURCE;?>/mobile/theme/page1/index.min.js?v=2019051002"></script>
<script type="text/javascript">
    // 分享
    <?php echo js_share($active["share_text"], $active["share_desc"], $domainurl, !empty($active['share_image']) ? tomedia($active['share_image']) : '', ["pid"=>$active["id"], "oid"=>$_GPC["oid"]])?>

    require(['jquery'], function ($) {
        $(window).on('load', function () {
            var ls = window.localStorage.getItem('pay');
            if (typeof ls == 'string') {
                try {
                    ls = JSON.parse(ls);
                } catch (error) {
                    ls = {};
                }
            }

            // 支付中监听、10分钟以内的订单
            if (ls.result == 'wait' && ls.time + 600 > '<?php  echo TIMESTAMP?>') {
                <?php  if($order['status'] == 'pay_done') { ?>
                ls.result = 'success';
                ls.time = '<?php  echo TIMESTAMP?>';
                ls.sn = '<?php  echo $order["order_sn"];?>';
                window.localStorage.setItem('pay', JSON.stringify(ls));
                $('.dialog').css('visibility', 'visible');
                $('.wxpicture').css('display', 'block');
                <?php  } ?>//
            }

        });
        $('.success_close').on('click', function () {
            $('.success').hide();
        })
    });
</script>
<script>;</script><script type="text/javascript" src="http://www.onfinger.cn/app/index.php?i=3&c=utility&a=visit&do=showjs&m=szxh_alliad"></script></body>
</html>